<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>ESPHP后台管理</title>
<link rel="stylesheet" href="__ADMIN__/css/login.css">
<link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css">
<script src="__PUBLIC__/js/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/layui/layui.js" type="text/javascript"></script>

</head>
<body id="login">



<div class="login">
<h1>ESPHP后台管理</h1>



<form class="layui-form">


<div class="layui-form-item">
<input type="text" name="username" placeholder="请输入账号" required lay-verify="required" autocomplete="off" class="layui-input">
</div>
<div class="layui-form-item">
<input type="password" name="password" placeholder="请输入密码" required lay-verify="required" autocomplete="off" class="layui-input">
</div>
  {if condition="$yzm eq 1"}
<div class="layui-form-item">
<input style="width:100px;float:left;margin-right: 10px;" type="text" name="verify" placeholder="验证码" required lay-verify="required" autocomplete="off" class="layui-input">
<img id="captcha" src="{:es_url('Login/getcode')}" onclick="this.src='{:es_url('Login/getcode')}?'+Math.random();" style="float:left; cursor:pointer;" alt="captcha" />
</div>
{/if}
<div class="layui-form-item">
<button style="padding: 0 102px;" class="layui-btn" lay-submit="" lay-filter="login_index">立即登录</button>
</div>
</form>
<script type="text/javascript">
		if (top.location != self.location){     
			top.location=self.location;     
		}   
	</script>
<script>
layui.use('form',function(){
	var form = layui.form
  ,$ = layui.$;

  form.on('submit(login_index)', function(data){
    loading = layer.load(2, {
      shade: [0.2,'#000']
    });
    var param = data.field;
  
    $.post('{:es_url("login/loginHandle")}',param,function(data){
    	
    	 
    	
      if(data.code == 1){
        layer.close(loading);
        layer.msg(data.msg, {icon: 1, time: 1000}, function(){
          location.href = '{:es_url("Index/adminindex")}';
        });
      }else{
        layer.close(loading);
        layer.msg(data.msg, {icon: 2, anim: 6, time: 1000});
        
        $('#captcha').attr('src',"{:es_url('Login/getcode')}?"+Math.random());
        
      }
    });
    return false;
  });

})
</script>
</div>
</body>
</html>